using UnityEngine;

namespace Coffee.UIExtensions
{
    // [Assembly-CSharp.dll].Coffee.UIExtensions.EffectAreaExtensions
    public static class EffectAreaExtensions
    {
        // Fields
        private static readonly UnityEngine.Rect rectForCharacter;
        
        // Methods
        public static UnityEngine.Rect GetEffectArea(Coffee.UIExtensions.EffectArea area, UnityEngine.UI.VertexHelper vh, UnityEngine.UI.Graphic graphic, float aspectRatio = -1)
        {
            var val_17;
            float val_18;
            var val_20;
            val_17 = graphic;
            val_18 = 0;
            if(area == 2)
            {
                goto label_1;
            }
            
            if(area == 1)
            {
                goto label_2;
            }
            
            UnityEngine.Rect val_2 = val_17.rectTransform.rect;
            goto label_9;
            label_2:
            val_2.m_XMin.yMin = -1.175494E-38f;
            val_2.m_XMin.xMin = -1.175494E-38f;
            val_2.m_XMin.yMax = 1.175494E-38f;
            val_18 = 1.175494E-38f;
            val_2.m_XMin.xMax = val_18;
            if(vh.currentVertCount < 1)
            {
                goto label_9;
            }
            
            do
            {
                vh.PopulateUIVertex(vertex:  new UnityEngine.UIVertex() {position = new UnityEngine.Vector3() {x = 0f, y = 0f, z = 0f}, normal = new UnityEngine.Vector3() {x = 0f, y = 0f, z = 0f}, tangent = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, color = new UnityEngine.Color32(), uv0 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, uv1 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, uv2 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}, uv3 = new UnityEngine.Vector4() {x = 0f, y = 0f, z = 0f, w = 0f}}, i:  0);
                float val_4 = val_2.m_XMin.xMin;
                val_2.m_XMin.xMin = (val_4 < 0) ? (val_4) : 0f;
                float val_6 = val_2.m_XMin.yMin;
                val_2.m_XMin.yMin = (val_6 < 0) ? (val_6) : 0f;
                float val_8 = val_2.m_XMin.xMax;
                val_2.m_XMin.xMax = (val_8 > 0f) ? (val_8) : 0f;
                float val_10 = val_2.m_XMin.yMax;
                val_2.m_XMin.yMax = (val_10 > 0f) ? (val_10) : 0f;
                val_17 = 0 + 1;
            }
            while(val_17 < vh.currentVertCount);
            
            goto label_9;
            label_1:
            val_20 = 536885467;
            if(mem[536885691] == 0)
            {
                    val_20 = 536885467;
            }
            
            label_9:
            if(aspectRatio <= 0f)
            {
                    return new UnityEngine.Rect() {m_XMin = mem[536885651], m_YMin = mem[536885651], m_Width = mem[536885651], m_Height = mem[536885651]};
            }
            
            float val_14 = mem[536885651].height;
            if(mem[536885651].width < 0)
            {
                    float val_15 = mem[536885651].height;
                val_15 = val_15 * aspectRatio;
                mem[536885651].width = val_15;
                return new UnityEngine.Rect() {m_XMin = mem[536885651], m_YMin = mem[536885651], m_Width = mem[536885651], m_Height = mem[536885651]};
            }
            
            float val_16 = mem[536885651].width;
            val_16 = val_16 / aspectRatio;
            mem[536885651].height = val_16;
            return new UnityEngine.Rect() {m_XMin = mem[536885651], m_YMin = mem[536885651], m_Width = mem[536885651], m_Height = mem[536885651]};
        }
        private static EffectAreaExtensions()
        {
            UnityEngine.Rect val_1 = new UnityEngine.Rect(x:  0f, y:  0f, width:  1f, height:  1f);
            mem2[0] = val_1.m_XMin;
        }
    
    }

}
